<template>
  <div v-if="detail">
    <div id="positionnav" class="loc2">
      <div class="container">
        <div id="position">
          您的位置：<router-link :to="{ name: 'Home' }">
            {{ $t("nav_home") }}</router-link
          >
          <i class="fa fa-angle-right"></i>
          <router-link :to="{ name: 'People' }">
            {{ $t("nav_people") }}
          </router-link>
          <i class="fa fa-angle-right"></i>
          <router-link :to="{ name: 'People', query: pushObj.query }">
            {{ pushObj.text }}
          </router-link>
        </div>
        <div class="rynav">
          <ul>
            <li>
              <router-link
                :class="{ sel: pushObj.secCateId == 5 }"
                :to="{ name: 'People', query: { tab: 1 } }"
              >
                {{ $t("directors") }}
              </router-link>
            </li>

            <li>
              <router-link
                :class="{ sel: pushObj.secCateId == 6 }"
                :to="{ name: 'People', query: { tab: 2 } }"
              >
                {{ $t("advisory_board") }}
              </router-link>
            </li>
            <li>
              <router-link
                :class="{ sel: pushObj.secCateId == 7 }"
                :to="{ name: 'People', query: { tab: 3 } }"
              >
                {{ $t("researchers") }}
              </router-link>
            </li>
          </ul>
        </div>

        <div class="clearfix"></div>
      </div>
    </div>
    <div class="rypage container">
      <div id="postInfo">
        <p class="title">{{ title }}</p>
        <p class="subtitle">
          {{ subTitle }}
        </p>
      </div>
      <div class="body">
        <div class="row">
          <div class="col-sm-9">
            <div class="teamdetail" v-html="contentHtml"></div>
          </div>
          <div class="col-sm-3">
            <div class="teamimg">
              <img :src="detail.cover | pathImg" alt="" />
            </div>
          </div>
        </div>
      </div>
      <!-- <div id="tabBtn">
        <a href="javascript:void(0);" class="post-prev">
          <div class="img-wrap">
            <img src="/images/nophoto.jpg" alt="" />
          </div>
          <div class="infor-wrap">
            <span class="title"> </span>
          </div>
          <i class="details"></i>
        </a>

        <a href="/view.php?id=163" class="post-next">
          <div class="img-wrap">
            <img
              src="/uploads/image/20200131/20200131152206_86582.jpg"
              alt=""
            />
          </div>
          <div class="infor-wrap">
            <span class="title"> Wim Coreynen</span>
          </div>
          <i class="details"></i>
        </a>
      </div> -->
    </div>
  </div>
</template>
<script>
import { isEn, escapeHtml } from '@/common/util';
import { getContentData } from '@/service/getData.js'
export default {
  data() {
    return {
      tab: 1,
      detail: null,
      pushObj: {
        secCateId: 7,
        query: { tab: 3 },
        text: this.$t("researchers")
      }
    }
  },
  computed: {
    title() {
      return isEn() ? this.detail.title_en : this.detail.title
    },
    subTitle() {
      return isEn() ? this.detail.extra_en : this.detail.extra
    },
    contentHtml() {
      return isEn() ? escapeHtml(this.detail.content_en) : escapeHtml(this.detail.content)
    }
  },
  mounted() {
    this.getContent(this.$route.query.id || '')
  },
  methods: {
    async getContent(detailId) {
      if (!detailId) return
      let res = await getContentData(detailId)
      if (res) {
        this.detail = res
        this.getSecCateId(this.detail.sec_cate_id)
      }
    },
    getSecCateId(secCateId) {
      // let text = this.$t("researchers")
       let text = this.$t("directors")
      let tab = 3
      switch (secCateId) {
        case 6:
          text = this.$t("directors")
          tab = 1
          break;
        case 7:
          text = this.$t("advisory_board")
          tab = 2
          break;
        // case 7:
        //   text = this.$t("researchers")
        //   tab = 3
        //   break;
        default:
          break;
      }
      this.pushObj = {
        secCateId: secCateId,
        query: { tab: tab },
        text: text
      }
    }
  },
}
</script>
<style scope>
#ny-banner {
  width: 100%;
  overflow: hidden;
}
.ny-banner-box {
  width: 100%;
  position: relative;
}

.ny-banner-box > img {
  width: 100%;
}
.teamimg img {
  max-height: 250px;
}

#positionnav {
  margin-top: 40px;
}
#positionnav .container {
  position: relative;
}
.rynav {
  position: relative;
  width: 100%;
  height: 32px;
  z-index: 8;
  margin-top: 8px;
}
.rynav ul {
  margin-left: -5px;
  margin-right: -5px;
}
.rynav li {
  padding-left: 5px;
  padding-right: 5px;
  float: left;
}
.rynav li a {
  height: 32px;
  display: inline-block;
  padding: 0px 20px;
  transition: all 0.3s ease-out 0s;
  position: relative;
  color: #737373;
}
.rynav li a.sel {
  color: #233876;
}
.rynav li a:hover {
  color: #233876;
}
#position {
  width: 300px;
  z-index: 10;
  font-size: 12px;
  display: block;
  position: absolute;
  right: 15px;
  text-align: right;
  top: 8px;
}

#position a {
  color: #999;
}
#position i {
  margin: 0 10px;
  color: #6f6f6f;
}
#position .container > a:last-child {
  color: #233876;
}

#positionnav.loc2 {
  margin-top: 0;
  background-color: #f7f7f7;
  height: 49px;
  line-height: 35px;
}

@media (max-width: 1024px) {
  #positionnav {
    margin-top: 5px;
  }
  #position {
    position: relative;
    width: 100%;
    display: block;
    right: 0;
  }
  .rynav {
    position: relative;
    width: 100%;
    display: block;
    margin-top: 22px;
  }
  .rynav li {
    margin-bottom: 3px;
  }
}
</style>
<style scope>
.category_title {
  width: 100%;
  text-align: center;
}
.category_title h2 {
  color: #233876;
  font-size: 22px;
  font-weight: normal;
}
.category_title h3 {
  color: #aaa;
  font-size: 14px;
  font-weight: normal;
}
.rypage h1 {
  font-size: 17px;
  line-height: 30px;
  color: #303030;
  width: 100%;
  display: block;
  text-align: center;
  padding: 0px 0 30px;
  border-bottom: 1px solid #e5e5e5;
}
.body {
  padding-top: 10px;
  margin-bottom: 60px;
  color: #999;
}

.rypage #postInfo {
  padding-top: 5px;
  padding-bottom: 2px;
  border-bottom: 1px solid #e5e5e5;
}

.rypage #postInfo .title {
  font-size: 18px;
  line-height: 30px;
  color: #333;
}

.rypage #postInfo .subtitle {
  font-size: 14px;
  line-height: 30px;
  color: #666;
}

.teamimg {
  background-color: #f3f3f3;
  width: 100;
  text-align: center;
}

#tabBtn::after {
  content: "";
  display: block;
  clear: both;
}

#tabBtn .post-next,
#tabBtn .post-prev {
  transition: all 0.36s ease;
  position: relative;
  width: 50%;
  height: 120px;
  overflow: hidden;
  float: left;
  padding: 10px;
  box-sizing: border-box;
  background: #f5f5f5;
}

#tabBtn .post-next:not(.empty):hover,
#tabBtn .post-prev:not(.empty):hover {
  background: #2d417b;
}

#tabBtn .post-next:not(.empty):hover .infor-wrap .title,
#tabBtn .post-prev:not(.empty):hover .infor-wrap .title {
  color: #fff;
}

#tabBtn .post-next:not(.empty):hover .infor-wrap .subtitle,
#tabBtn .post-prev:not(.empty):hover .infor-wrap .subtitle {
  color: #a0a6bc;
}

#tabBtn .post-next:not(.empty):hover .img-wrap,
#tabBtn .post-prev:not(.empty):hover .img-wrap {
  opacity: 1;
}

#tabBtn .post-next.empty,
#tabBtn .post-prev.empty {
  cursor: default;
}

#tabBtn .post-next.empty .details,
#tabBtn .post-prev.empty .details {
  display: none;
}

#tabBtn .post-next .img-wrap,
#tabBtn .post-prev .img-wrap {
  transition: all 0.36s ease;
  opacity: 0;
  width: 80px;
  height: auto;
  position: absolute;
  top: 50%;
  -webkit-transform: translateY(-50%);
  -ms-transform: translateY(-50%);
  transform: translateY(-50%);
}

#tabBtn .post-next .img-wrap img,
#tabBtn .post-prev .img-wrap img {
  width: 100%;
}

#tabBtn .post-next .details,
#tabBtn .post-prev .details {
  position: absolute;
  top: 50%;
  -webkit-transform: translateY(-50%);
  -ms-transform: translateY(-50%);
  transform: translateY(-50%);
  width: 40px;
  height: 16px;
  color: transparent;
  overflow: hidden;
}

#tabBtn .post-next .infor-wrap,
#tabBtn .post-prev .infor-wrap {
  width: 250px;
}

#tabBtn .post-next .infor-wrap .title,
#tabBtn .post-prev .infor-wrap .title {
  transition: all 0.36s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 16px;
  line-height: 100px;
  display: block;
  color: #666;
}

#tabBtn .post-next .infor-wrap .subtitle,
#tabBtn .post-prev .infor-wrap .subtitle {
  transition: all 0.36s ease;
  display: none;
  height: 30px;
  overflow: hidden;
  font-size: 13px;
  line-height: 30px;
}

#tabBtn .post-prev {
  float: left;
  padding-left: 106px;
}

#tabBtn .post-prev:hover .details:before {
  right: 60px;
}

#tabBtn .post-prev:hover .details:after {
  right: 15px;
  opacity: 1;
}

#tabBtn .post-prev .img-wrap {
  right: 15px;
}

#tabBtn .post-prev .infor-wrap {
  float: left;
}

#tabBtn .post-prev .details {
  border-right: 1px solid #e5e5e5;
  left: 22px;
}

#tabBtn .post-prev .details:after,
#tabBtn .post-prev .details:before {
  content: "\e729";
  font-family: "iconfont" !important;
  speak: none;
  font-style: normal;
  font-weight: 400;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  transition: all 0.36s ease;
  color: #999;
  position: absolute;
  top: 50%;
  font-size: 20px;
  -webkit-transform: translateY(-50%);
  -ms-transform: translateY(-50%);
  transform: translateY(-50%);
}

#tabBtn .post-prev .details:before {
  right: 15px;
}

#tabBtn .post-prev .details:after {
  right: -30px;
  opacity: 0;
}

#tabBtn .post-next {
  float: right;
  padding-right: 106px;
}

#tabBtn .post-next:hover .details:before {
  left: 60px;
}

#tabBtn .post-next:hover .details:after {
  left: 15px;
  opacity: 1;
}

#tabBtn .post-next .img-wrap {
  left: 15px;
}

#tabBtn .post-next .infor-wrap {
  float: right;
}

#tabBtn .post-next .details {
  right: 22px;
  border-left: 1px solid #e5e5e5;
}

#tabBtn .post-next .details:after,
#tabBtn .post-next .details:before {
  content: "\e727";
  font-family: "iconfont" !important;
  speak: none;
  font-style: normal;
  font-weight: 400;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  transition: all 0.36s ease;
  color: #999;
  position: absolute;
  top: 50%;
  font-size: 20px;
  -webkit-transform: translateY(-50%);
  -ms-transform: translateY(-50%);
  transform: translateY(-50%);
}

#tabBtn .post-next .details:before {
  left: 15px;
}

#tabBtn .post-next .details:after {
  left: -30px;
  opacity: 0;
}

#tabBtn .post-next .infor-wrap .title {
  text-align: right;
}
</style>